module(
    name = "download_utils",
    version = "1.2.0",
    bazel_compatibility = [
        ">=7.1.0",
    ],
    compatibility_level = 1,
)

bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "bazel_skylib", version = "1.8.1")

bazel_dep(name = "toolchain_utils", version = "1.0.2", dev_dependency = True)
bazel_dep(name = "hermetic_cc_toolchain", version = "3.1.0", dev_dependency = True)

# We have to avoid the `chmod`/`chown`/`id` unhermetic-ness
# TODO: remove this when `ignore_root_user_error` is hermetic
dev = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
dev.toolchain(
    # TODO: remove this when `ignore_root_user_error` is hermetic
    # https://github.com/bazelbuild/rules_python/issues/2016
    ignore_root_user_error = True,
    python_version = "3.13",
)

separator = use_repo_rule("//lib:separator.bzl", "separator")

separator(name = "separator")

download = use_extension("//download/template:defs.bzl", "download_template")
download.substitutions(
    srcs = [
        "//download/template:rust.json",
        "//download/template:triplet.json",
    ],
)
download.substitution(
    key = "executable.extension",
    match = "{os}",
    select = {
        "windows": ".exe",
        "//conditions:default": "",
    },
)
